UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lkSgiZommG9uhDqJaTxgJcrzw5BQXwyfmvYsgyOikrA='
WHERE
key_id = '6ba4cf93c067ac504b0443189ea4a24f7228d14267e37700cdaf52e868a44cf0'
AND (
token = 'lkSgiZommG9uhDqJaTxgJcrzw5BQXwyfmvYsgyOikrA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)