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