UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBQpNg39sSRiJZytdP7kgZ/bG9bgQ7/ET5SaETIVr1U=' 
WHERE 
  key_id = 'b2d0f37491a3596f925eb379f1d162f8f1315a8c2c446d058b36ce1de5adb455' 
  AND (
    token = 'dBQpNg39sSRiJZytdP7kgZ/bG9bgQ7/ET5SaETIVr1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038