UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0cQshWqdrIt7PvSNZtiSvP8pUS91tuaQoohFrk15GhE='
WHERE
key_id = '27d62fae638e3123e9e33f2ae11255e50180a17d40da639fb9935a1bcec1aaef'
AND (
token = '0cQshWqdrIt7PvSNZtiSvP8pUS91tuaQoohFrk15GhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)