UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sgLlkxFS2INAA1dKrUEnEGrxlSI6AGkczIcDPaSC+BU='
WHERE
key_id = '8eda3bef202613da09c868453905bc616d77e46a6927cd5e59cad658ab88312b'
AND (
token = 'sgLlkxFS2INAA1dKrUEnEGrxlSI6AGkczIcDPaSC+BU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)