UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Bx7POS3s2e5+5XBOearn15jPNMJ7x5InE81N2gtSKk=' 
WHERE 
  key_id = '6b538712c0b370123ea0337f989fc0183ec2b0f02bed28b664710f8b1dfc75bc' 
  AND (
    token = '7Bx7POS3s2e5+5XBOearn15jPNMJ7x5InE81N2gtSKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074