UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tshBVXvvjtqTdzY1UYW1PzBTiq6pyljAec2ANci5niM='
WHERE
key_id = '58bc2949dcb968e42b02fd47a69a213716338058bef34d2993eeae31aa6027f5'
AND (
token = 'tshBVXvvjtqTdzY1UYW1PzBTiq6pyljAec2ANci5niM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)