UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e9nzglyJMQSmQrq85+YUUmVpUTBfB/mM7VrTm8CikhQ='
WHERE
key_id = 'a74b86839bc4ea1dddef6e07ed8e721e4b4d970570d7d277a55e246f0b1f8a65'
AND (
token = 'e9nzglyJMQSmQrq85+YUUmVpUTBfB/mM7VrTm8CikhQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)