UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ksp0nJwMKiUvsBVQsOznTh0hKamw4fTP7NG6yV0WsrM='
WHERE
key_id = '7cacbefc00da194828d2f1a3e656f14c71b7481ca5bc27f3b7224bca1bb2dbd9'
AND (
token = 'ksp0nJwMKiUvsBVQsOznTh0hKamw4fTP7NG6yV0WsrM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)