UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RmV98xUozexNEYO0JaehLTlh8s+pZO3qUwqA4NXRL5g=' 
WHERE 
  key_id = 'e39f6f7c56ad11f5f501692c8d3f559fc22f01274ff74bd8c85b9118134aa2e4' 
  AND (
    token = 'RmV98xUozexNEYO0JaehLTlh8s+pZO3qUwqA4NXRL5g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055