UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v6NzpjdsU72pMMLx/0X1ON+UkIPtNvX+NZ1kiKZqlTw=' 
WHERE 
  key_id = '3833554ccca12f70a804f57b36f12a64424bc2a5d3258fd5f122ddff57723454' 
  AND (
    token = 'v6NzpjdsU72pMMLx/0X1ON+UkIPtNvX+NZ1kiKZqlTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039