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

Query time 0.00056