UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sgk5irOxiO5tv/pGFixOnnjpEh6iV5d+H7E9sTTtm9M='
WHERE
key_id = '1f8f2fddf647acc0523fe040b9c77d942095d794bb99624c29f70fa3d6fdf82f'
AND (
token = 'Sgk5irOxiO5tv/pGFixOnnjpEh6iV5d+H7E9sTTtm9M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)