UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PeGp0cq/6Ue1oNXQXJQeFEXCpZf4YpP1ofnYLOoc9VM=' 
WHERE 
  key_id = '76e8121d0f9751fcb38a8ea25b81039e74ca519adef433a389688f1182f37215' 
  AND (
    token = 'PeGp0cq/6Ue1oNXQXJQeFEXCpZf4YpP1ofnYLOoc9VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051