UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YqKk8+GeFOVnRoIN6wyV1Ew+Eh3uaVCfDJECTUEI7Rs=' 
WHERE 
  key_id = '67be439d8da23b11547da0782f444577c71f1e5b25780c4f302169d0f602e80b' 
  AND (
    token = 'YqKk8+GeFOVnRoIN6wyV1Ew+Eh3uaVCfDJECTUEI7Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036