UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wIPM0TvQYz9Qt69TTA8x/zCftIUcC4jYZRFPwCzGCaU=' 
WHERE 
  key_id = '0afd0f8e65036b8329d0ea0b0b0d7154d56e19fd1f2f97a1ef46bbef56567b04' 
  AND (
    token = 'wIPM0TvQYz9Qt69TTA8x/zCftIUcC4jYZRFPwCzGCaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036