UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3Nb5VR0aWNjp3IzIGHdYBWrHBImM1y0zQH3UqzTb4jA=' 
WHERE 
  key_id = 'da50c00ec707a91508ed09f5367bec4b5689b36f7faad07be351224a462cb113' 
  AND (
    token = '3Nb5VR0aWNjp3IzIGHdYBWrHBImM1y0zQH3UqzTb4jA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038