UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NjRK0En+yXxHKGQ2MrOgmxDzekXTuabbHlOZzFZN2KU=' 
WHERE 
  key_id = '0eb019cfa4f3dcee7b3a97d7a3a4bf97eac96eb7fc3929add180cd359ef3600a' 
  AND (
    token = 'NjRK0En+yXxHKGQ2MrOgmxDzekXTuabbHlOZzFZN2KU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032