UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jHdNewaYBNVWh7APwYL0ESEWMDX9XeXDZYVwpT7XbIU=' 
WHERE 
  key_id = '07fa0641c27b1cb5d63336cc140df459dacfb9d66653905d57ec544f782b7c75' 
  AND (
    token = 'jHdNewaYBNVWh7APwYL0ESEWMDX9XeXDZYVwpT7XbIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041