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