UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6kpzGAXOYfCSoPa+FrKMJaSDJazA2dAoFkmKz9q6Uys=' 
WHERE 
  key_id = '38a413d4504ff38ce550548d66d1459c4179064f2e5e79fb82052a9008c487e4' 
  AND (
    token = '6kpzGAXOYfCSoPa+FrKMJaSDJazA2dAoFkmKz9q6Uys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012