UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2LCkqDsuD3bpSTmZvrv99MdFylI0wwbb0drOIhHzRgM='
WHERE
key_id = 'be01065c865acd0f35af26eb1f02877e1990b16a5b936e4e117a252ef2262121'
AND (
token = '2LCkqDsuD3bpSTmZvrv99MdFylI0wwbb0drOIhHzRgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)