UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1loorgikunUAl+thZxzv/Zj4M5Tzvt8OTHl2aLW3IR4=' 
WHERE 
  key_id = '077a964c08d6c470b50f916bb463f200ab66a8d10cb7f816adeee7d52677ab7a' 
  AND (
    token = '1loorgikunUAl+thZxzv/Zj4M5Tzvt8OTHl2aLW3IR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038