UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mNylHJC98RWyE/3q0mIT8rzWYz1F/rhV8/MHTck6Kg0=' 
WHERE 
  key_id = 'f5f216e9c48699a48d89ad096075d918c116f3711740b9fb032f31a59ee8f080' 
  AND (
    token = 'mNylHJC98RWyE/3q0mIT8rzWYz1F/rhV8/MHTck6Kg0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032