UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WiB3H2RYYdvGYAyBRfdD0Zj+U0wH9QP4gayUDHioY/k=' 
WHERE 
  key_id = '3cd8c1360735018813f0c070118037b15b38c782d2f195e930522e48f88290c1' 
  AND (
    token = 'WiB3H2RYYdvGYAyBRfdD0Zj+U0wH9QP4gayUDHioY/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023