UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mP1tuHrAWeLeKqK46bcZ43LCEKJNJ1fZ3SwfnaLfwQI=' 
WHERE 
  key_id = '7c3d10784c8c9b335c60b815925a5b8062152775863b2341581410c9881a2af5' 
  AND (
    token = 'mP1tuHrAWeLeKqK46bcZ43LCEKJNJ1fZ3SwfnaLfwQI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042