UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WzDuf7qksXVT05R6FJflXPvZ6efi9TJB+ezE3FCY51g='
WHERE
key_id = 'dde871acb950f43d1262ee4f87f2b473b7e5d1e27e783127b361244c19de393b'
AND (
token = 'WzDuf7qksXVT05R6FJflXPvZ6efi9TJB+ezE3FCY51g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)