UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2NYz7ubE8cbRx7J9xoss3mcA4iUydFx2HaSuNyR+eJg='
WHERE
key_id = '144ad445d9c5bd21ff26aa088200bafae26f64d44785c025b8bc482b890dae4d'
AND (
token = '2NYz7ubE8cbRx7J9xoss3mcA4iUydFx2HaSuNyR+eJg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)