UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n5yRuzwAkYk46pzko7oryRGRpkwzXcXhqFvU+93CSSY=' 
WHERE 
  key_id = 'f8689b4685a682f682f8af0e112d312853368d9792ea74d66883c2071e6cf407' 
  AND (
    token = 'n5yRuzwAkYk46pzko7oryRGRpkwzXcXhqFvU+93CSSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027