UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dvCyDfvEH0edhSnoDDoBo5ljZ81Ea4shHgxupGSYSDU='
WHERE
key_id = 'a5d4262eb3c2d81513ecef1741a79f8092f55e3192d4c022e0583ba820266f9b'
AND (
token = 'dvCyDfvEH0edhSnoDDoBo5ljZ81Ea4shHgxupGSYSDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)