UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yhgqLPJnCDOrthYlzg5K8+2KCzrLY6bi/aH+IahP8lM=' 
WHERE 
  key_id = '55260dfb900c876c5eb8c14af3323b8787e04b9c46080f845ddf513121d76734' 
  AND (
    token = 'yhgqLPJnCDOrthYlzg5K8+2KCzrLY6bi/aH+IahP8lM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034