UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A8GmG1kHRhrvRRlXb4X7PQ2m7DGgKA0gOptVBoUHYdE='
WHERE
key_id = 'f3161aead24b1532f1f1e39f90c186a9ea12edf01e0f218a64f5b8a93b1b2f6a'
AND (
token = 'A8GmG1kHRhrvRRlXb4X7PQ2m7DGgKA0gOptVBoUHYdE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)