UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5O9Ir3buFsVbzoLl1bcLQGmWhFXjslEmhug9EbGF1vc='
WHERE
key_id = '39844e31956bab383e308031963188c2abf3f8dd1e438a9d632276a530a38c59'
AND (
token = '5O9Ir3buFsVbzoLl1bcLQGmWhFXjslEmhug9EbGF1vc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)