UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd/L+cJcyLwEVTwaV0SnUeYqeJOjSlOcg5UWSauKUuv8=' 
WHERE 
  key_id = 'edb4d535c35638efe20c55e298cb4dc2d73687310c0a3fdb738be4eea8cb604a' 
  AND (
    token = 'd/L+cJcyLwEVTwaV0SnUeYqeJOjSlOcg5UWSauKUuv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044