UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o4UUoeSEkZgu6ecGto4/x7RQQDaSuOIIhIMUcxkAyMg=' 
WHERE 
  key_id = 'e1001ab756743f0fbaa57643985c83cfbf35780cd51b72bd3ad967a66e34ddc5' 
  AND (
    token = 'o4UUoeSEkZgu6ecGto4/x7RQQDaSuOIIhIMUcxkAyMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026