UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PZ+0D/9BwypzGFThiXfsprtWDh5yrEEHXYGFNhK4Ako=' 
WHERE 
  key_id = '336e4c297c43cf772e931ac9b4b8007e3f5230756e8fc7005a957764526f98d9' 
  AND (
    token = 'PZ+0D/9BwypzGFThiXfsprtWDh5yrEEHXYGFNhK4Ako=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029