UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0rWhmglZzth3fb7n19g0eW3FGsJq9jvZfBEsPY8sYq8='
WHERE
key_id = '25653ac168cdcf5a2b7825baa9c8f0a9f1bac262d838b0daee6305239294ef18'
AND (
token = '0rWhmglZzth3fb7n19g0eW3FGsJq9jvZfBEsPY8sYq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)