UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y0fdWAseRqtRu6mOrhZ79FotUt9pNfoujOfAYvkbCF8=' 
WHERE 
  key_id = '4fd95777beeeca975fd3cf61d3a227c83de634e6ab064785a390108b225e1712' 
  AND (
    token = 'y0fdWAseRqtRu6mOrhZ79FotUt9pNfoujOfAYvkbCF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032