UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XSldjCB0lCYS3FShgnyfGR+EmegCAA0qd/0GsfBOM/w='
WHERE
key_id = '7c469ac780b2fe2008ba2de2285f778a75504b96ddd80f30894188745929be77'
AND (
token = 'XSldjCB0lCYS3FShgnyfGR+EmegCAA0qd/0GsfBOM/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)