UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tk5XiX/PsAVmBOkKen0RoadqzCqzNW8cMruSnZmNWs8='
WHERE
key_id = 'b48787b9bdecbe3fbcb77142588fddfde90d4778c6550202b7b2beff097378e6'
AND (
token = 'Tk5XiX/PsAVmBOkKen0RoadqzCqzNW8cMruSnZmNWs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)