UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bco2True8VFYoy9QRnGDEFt8o949f6almOBGn8BaIXM=' 
WHERE 
  key_id = '24035e01772b33c0b5792a374224647974dd92951699d1c9ae5e212f33c3e3fb' 
  AND (
    token = 'bco2True8VFYoy9QRnGDEFt8o949f6almOBGn8BaIXM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029