UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yij6v62hrhtYxZSSAJT4P30at7sTyZ9o7DSQULFjvV8=' 
WHERE 
  key_id = '3cbd5880642662c64ddda7be478e8f7cbd5c6dece791607a50abef10698d7d79' 
  AND (
    token = 'yij6v62hrhtYxZSSAJT4P30at7sTyZ9o7DSQULFjvV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035