UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kKBCDlKbTF7i2e63UE/H3rDOxXrMZTBTIwe5jSlSsSE=' 
WHERE 
  key_id = 'c6161670fc09194e5b0e0bad3ec2196782060d993c390824eba8379c2113e769' 
  AND (
    token = 'kKBCDlKbTF7i2e63UE/H3rDOxXrMZTBTIwe5jSlSsSE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051